﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Nature
{
    /// <summary>
    /// Defines a generalized method that a value type or class implements to create a type-specific method for 
    /// determining rough equality of instances. The comparison accuracy is determined by the specified tolerance value
    /// </summary>
    /// <typeparam name="TType">The type of objects to compare.</typeparam>
    /// <typeparam name="TValue">The tolerance underlying type.</typeparam>
    public interface IRoughlyEquatable<TType, TValue>
    {
        /// <summary>
        /// Indicates whether the current object is roughly equal to another object of the same type.
        /// </summary>
        /// <typeparam name="TTolerance">Generic tolerance type</typeparam>
        /// <param name="other">An object to compare with this object.</param>
        /// <param name="tolerance">A tolerance object determining the comparison accuracy</param>
        /// <returns>true if the current object is roughly equal to the other parameter; otherwise, false.</returns>
        bool IsSame<TTolerance>(TType other, TTolerance tolerance) where TTolerance : ITolerance<TValue>;
    }

    /// <summary>
    /// Defines a generalized method that a value type or class implements to create a type-specific method for 
    /// determining rough equality of instances. The comparison accuracy is determined by the specified tolerance value
    /// </summary>
    /// <typeparam name="TType">The type of objects to compare.</typeparam>
    public interface IRoughlyEquatable<TType> : IRoughlyEquatable<TType, double> { }    
}
